package com.qqt.csr.im.dto;

import com.qqt.csr.im.enums.ReadFlagEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author: yang hao
 * @Date: 2024/10/17 11:12
 * @Description: 系统消息发送 dto
 **/
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "系统消息发送")
public class SendSystemMessageDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "用户id不能为空")
    @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
    private String userId;

    @Schema(description = "会话id")
    private String conversationId;

    @Schema(description = "消息")
    private String message;

    @Schema(description = "默认设置已读状态，0：未读，1：已读")
    private ReadFlagEnum readFlag;

    @Schema(description = "消息扩展消息")
    private String ext;

    private String roomId;

    public static SendSystemMessageDTO of(String userId, String conversationId, String message, String ext, String roomId) {
        return SendSystemMessageDTO.builder()
                .userId(userId)
                .conversationId(conversationId)
                .message(message)
                .readFlag(ReadFlagEnum.READ)
                .ext(ext)
                .roomId(roomId)
                .build();
    }

}
